package com.holyant.report.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.domain.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;

/**
 * 进销存结转统计dto
 * 
 * @author holyant
 * @date 2021-12-10
 */
@Data
@ApiModel("进销存结转统计")
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RptInventoryDto extends BaseDto {

    private static final long serialVersionUID = 1L;

    /** 日 */
    @Excel(name = "日")
    @ApiModelProperty(value = "日")
    private String accountDay;
    /** 仓库id */
    @Excel(name = "仓库id")
    @ApiModelProperty(value = "仓库id")
    private Long warehouseId;
    /** 仓库名称 */
    @Excel(name = "仓库名称")
    @ApiModelProperty(value = "仓库名称")
    private String warehouseName;
    /** 库位id */
    @Excel(name = "库位id")
    @ApiModelProperty(value = "库位id")
    private Long warelocationId;
    /** 库位名称 */
    @Excel(name = "库位名称")
    @ApiModelProperty(value = "库位名称")
    private String warelocationName;
    @ApiModelProperty(value = "库位类型")
    private Integer warelocationType;
    /** skuid */
    @Excel(name = "skuid")
    @ApiModelProperty(value = "skuid")
    private Long skuId;
    /** sku编码 */
    @Excel(name = "sku编码")
    @ApiModelProperty(value = "sku编码")
    private String skuCode;
    /** sku名称 */
    @Excel(name = "sku名称")
    @ApiModelProperty(value = "sku名称")
    private String skuName;
    /** 失效日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "失效日期", width = 30, dateFormat = "yyyy-MM-dd")
    @ApiModelProperty(value = "失效日期")
    private LocalDate expireDate;
    /** 商品条码 */
    @Excel(name = "商品条码")
    @ApiModelProperty(value = "商品条码")
    private String goodsBarcode;
    /** 商品id */
    @Excel(name = "商品id")
    @ApiModelProperty(value = "商品id")
    private Long goodsId;
    /** 商品名称 */
    @Excel(name = "商品名称")
    @ApiModelProperty(value = "商品名称")
    private String goodsName;
    /** 商品编码 */
    @Excel(name = "商品编码")
    @ApiModelProperty(value = "商品编码")
    private String goodsCode;
    /** 品牌ID */
    @Excel(name = "品牌ID")
    @ApiModelProperty(value = "品牌ID")
    private Long brandId;
    /** 品牌名称 */
    @Excel(name = "品牌名称")
    @ApiModelProperty(value = "品牌名称")
    private String brandName;
    /** 期初数量 */
    @Excel(name = "期初数量")
    @ApiModelProperty(value = "期初数量")
    private BigDecimal beginQty;
    /** 期末数量 */
    @Excel(name = "期末数量")
    @ApiModelProperty(value = "期末数量")
    private BigDecimal endQty;
    /** 本期入库数量 */
    @Excel(name = "本期入库数量")
    @ApiModelProperty(value = "本期入库数量")
    private BigDecimal inQty;
    /** 本期出库数量 */
    @Excel(name = "本期出库数量")
    @ApiModelProperty(value = "本期出库数量")
    private BigDecimal outQty;
    /** 本期入库数量明细json */
    @Excel(name = "本期入库数量明细json")
    @ApiModelProperty(value = "本期入库数量明细json")
    private String inData;

    @Excel(name = "在途数量")
    @ApiModelProperty(value = "在途数量,(采购在途,调拨在途)")
    private BigDecimal transitQty;

    @Excel(name = "销毁数量")
    @ApiModelProperty(value = "销毁数量(销毁冻结数量+出库类型是销毁出库的数量)")
    private BigDecimal destroyQty;

    /** 占用数量(占用数量=出库冻结+调拨冻结+锁定库存+移位冻结) */
    @Excel(name = "占用数量")
    @ApiModelProperty(value = "占用数量(占用数量=出库冻结+调拨冻结+锁定库存+移位冻结)")
    private BigDecimal occupyQty;


    @Excel(name = "销售数量")
    @ApiModelProperty(value = "销售数量(销售冻结数量+出库类型是销售出库的数量)")
    private BigDecimal salesQty;

    /** 本期出库数量明细json */
    @Excel(name = "本期出库数量明细json")
    @ApiModelProperty(value = "本期出库数量明细json")
    private String outData;
    /** 备注 */
    @Excel(name = "备注")
    @ApiModelProperty(value = "备注")
    private String remark;

    public void reCalEndQty() {
        this.endQty = this.beginQty.add(this.inQty).subtract(this.outQty);
    }

    /**
     * 日期列表
     */
    private List<String> queryDateList;


    /**
     * 库存总数
     */
    private BigDecimal allQty;



    /**
     * 采购在途
     */
    private BigDecimal purchaseTransitQty;



    /**
     * 调拨在途
     */
    private BigDecimal allotTransitQty;



//    private RptInventoryInDataDto rptInventoryInData;
//    private RptInventoryOutDataDto inventoryOutDataDto;

}
